//
//  WCWebFetchController.h
//  WebClipper
//
//  Created by Daniel Braun on 24/02/07.
//  Copyright 2007Daniel Braun http://page-appart.net, http://braun.daniel.free.fr  All rights reserved.
//

#import <Cocoa/Cocoa.h>

@class WebView;
@class WCWebExtractSet;
@class DOMNode;
@class WCWebExtractionItem;

#import "WCWebLoadProtocol.h"
@class MyDocument;

@interface WCWebFetchController: NSObject <WCWebLoadProtocol>  {
	IBOutlet MyDocument *myDocument;
	int editingMode;
	WCWebExtractSet *_eset;
	int _urlIndex;
	DOMHTMLElement *_documentRoot;
	WCWebExtractionItem *curitem;
	IBOutlet WebView *webViewBrowser;
	IBOutlet WebView *webViewExtraction;
	IBOutlet WebView *webViewResult;
	IBOutlet WebView *webViewSelection;
	IBOutlet WebView *webViewElement;
	IBOutlet NSTreeController *domCtrl;
	NSIndexSet *sei;
	BOOL loadingExtr;
	// WCWebLoadProtocol implementation
	SEL loadCallBackAction;
	id  loadCallBackTarget;
	id loadCallBackPrivate;
	IBOutlet NSView *converterView;
	NSMutableDictionary *configuredConverters;
#ifdef DOXYGEN
	WCExtractAction *__configuredConverters;
#endif
	//NSString *selectedConverterKey;
	IBOutlet NSBox *guiExtractorView;
	id extractionResult;
}
- (int) editingMode;
- (void) setEditingMode:(int)k;

- (void) setEset:(WCWebExtractSet *)eset;
- (WCWebExtractSet *) eset;
- (void) loadPage;

- (void) setSurl:(NSString *)s;
- (NSString *) surl;
- (void) setCurrentUrl:(NSURL *)nurl fromCache:(BOOL)fc variables:(NSDictionary *)v method:(NSString *)m forceNew:(BOOL)f;

- (WCWebExtractionItem *) curitem;
- (void) setCuritem:(WCWebExtractionItem *)c;

- (IBAction) browsingDone:(id)sender;
- (IBAction) parse:(id) sender;
- (IBAction) fetch:(id) sender;
- (IBAction) updateJS:(id) sender;

- (NSIndexSet *) selectedExtractionItem;
- (void) setSelectedExtractionItem:(NSIndexSet *)s;
- (BOOL) haveExtractionItem;

- (void) curpathUpdated;

- (NSArray *) possibleActions;
- (id) selectedAction;
- (void) setSelectedAction:(id)s;

- (void) updateExtractResult;
- (NSAttributedString *) extractionResult;

- (NSString *) jsCode;
@end
